/************************************************************************
                                                                     
   Xceed Ultimate ListBox for Silverlight                                                                                                                                            
   Copyright (C) 2010 Xceed Software Inc.    
                                                                     
   This program is provided to you under the terms of the GNU General Public  
   License version 2 as published by the Free Software Foundation. 
        
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY, without even the implied warranty of 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License along 
   with this program, if not, write to the Free Software Foundation, Inc., 
   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

   This program can be provided to you by Xceed Software Inc. under a
   proprietary commercial license agreement for use in non-Open Source
   projects. Visit Xceed.com to find the commercial edition of 
   Xceed Ultimate ListBox for Silverlight.                                    
                                                                      
 **********************************************************************/

using System;
using System.Windows;
using Xceed.Silverlight.Data;

namespace Xceed.Silverlight.ListBox
{
  [System.Diagnostics.DebuggerDisplay( "DataPath {DataPath}, TargetPosition {TargetPosition}, OpacityFactor {OpacityFactor}, ScalingFactor {ScalingFactor}" )]
  internal class ContainerDescription : IEquatable<ContainerDescription>
  {
    #region Contructor

    internal ContainerDescription()
    {
      this.Configuration = null;
      m_targetPosition = new Point( 0.0d, 0.0d );
    }

    #endregion

    #region Configuration Property

    internal ListBoxContainerConfigurationBase Configuration
    {
      get;
      set;
    }

    #endregion

    #region OpacityFactor Property

    internal double OpacityFactor
    {
      get;
      set;
    }

    #endregion

    #region ScalingFactor Property

    internal double ScalingFactor
    {
      get;
      set;
    } 

    #endregion

    #region RotateAngle Property

    internal double RotateAngle
    {
      get;
      set;
    }

    #endregion

    #region TargetPosition Property

    internal Point TargetPosition
    {
      get
      {
        return m_targetPosition;
      }

      set
      {
        if( value != null )
        {
          m_targetPosition = value;
        }
      }


    }

    private Point m_targetPosition;

    #endregion

    #region DataPath Property

    internal DataPath DataPath
    {
      get;
      set;
    }

    #endregion

    #region Rect Property

    internal Rect Rect
    {
      get 
      {
        return new Rect( this.TargetPosition,
                         this.Configuration.PrepareSize );
      }
    }

    #endregion

    #region ProportionInEffectiveViewport Property
    internal double ProportionInEffectiveViewport
    {
      get;
      set;
    }
    #endregion

    #region ZIndex Property

    internal int ZIndex
    {
      get;
      set;
    } 

    #endregion

    #region ScrollIndexAsTopItem Property

    internal double ScrollIndexAsTopItem
    {
      get;
      set;
    }

    #endregion

    #region ScrollIndexAsBottomItem Property

    internal double ScrollIndexAsBottomItem
    {
      get;
      set;
    }

    #endregion

    #region IEquatable<ContainerDescription> Members

    bool IEquatable<ContainerDescription>.Equals( ContainerDescription other )
    {
      if( other == null )
        return false;

      object otherDataPath = other.DataPath;
      object dataPath = this.DataPath;

      if( ( dataPath == null ) && ( otherDataPath == null ) )
        return true;

      if( dataPath != null )
        return dataPath.Equals( otherDataPath );

      return false;
    }

    #endregion
  }
}
